Create private file with JWT
This commit is contained in:
parent
881d01535d
commit
6907710f51
@ -1,6 +1,7 @@
|
|||||||
package de.hft.geotracker.activities
|
package de.hft.geotracker.activities
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@ -81,13 +82,16 @@ class Login : AppCompatActivity() {
|
|||||||
call.enqueue(object : Callback<Void> {
|
call.enqueue(object : Callback<Void> {
|
||||||
override fun onResponse(call: Call<Void>?, response: Response<Void>?) {
|
override fun onResponse(call: Call<Void>?, response: Response<Void>?) {
|
||||||
if(response != null && response.isSuccessful) {
|
if(response != null && response.isSuccessful) {
|
||||||
var headers = response.headers()
|
var headers = response.headers()
|
||||||
var authentication = headers.get("Authorization")
|
var authentication = headers.get("Authorization")
|
||||||
|
|
||||||
token = JWToken(authentication!!)
|
openFileOutput("JWToken", Context.MODE_PRIVATE).use {
|
||||||
println(response.code())
|
it.write(authentication!!.toByteArray())
|
||||||
println(token.token)
|
}
|
||||||
startActivity(intent)
|
token = JWToken(authentication!!)
|
||||||
|
println(response.code())
|
||||||
|
println(token.token)
|
||||||
|
startActivity(intent)
|
||||||
} else {
|
} else {
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
println(response.code())
|
println(response.code())
|
||||||
|
Loading…
Reference in New Issue
Block a user