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