5
votes

I am trying to add to my app VK authorization with Firebase SDK.

When user authorization finished, I try to pass token to Firebase.

func vkSdkAccessAuthorizationFinishedWithResult(result: VKAuthorizationResult!){

        let tokenString = result.token.description
        FIRAuth.auth()?.signInWithCustomToken(tokenString) { (user, error) in
            // ...

        }
    }

Error: [1] (null) "NSLocalizedDescription" : "The custom token format is incorrect. Please check the documentation."

Can I use Firebase with custom auth without running server?

1
can you post your code for create custom token .... - EI Captain v2.0
i get token from VK servers, in result - Eugene Strelnikov
no you have to create token with firebase.auth().createCustomToken(uid); for firebase ... then its working for you - EI Captain v2.0
I cant find any createCustomToken method. in documentation i saw it only in server configuration - Eugene Strelnikov

1 Answers

2
votes

From Firebase Doc. Create custom tokens using the Firebase SDK,

I would say that you need to use createCustomToken() method for this.. you can not use your VK servers token to signIn with firebase ... you need to generate token for firebase with createCustomToken() method.

 var uid = "some-uid";
 var customToken = firebase.auth().createCustomToken(uid);

May this work for you