Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Tokens To Be Passed #11

Closed
rlee1990 opened this issue Jun 30, 2021 · 14 comments
Closed

Allow Tokens To Be Passed #11

rlee1990 opened this issue Jun 30, 2021 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@rlee1990
Copy link

It would be useful to allow us to also just provide a token and not just a temp token or a token url as we are creating our tokens using accounts for string uids and so I get the token before calling the uikit functions but I can't pass it to uikit I receive an error for temptoken.

@rlee1990 rlee1990 added the enhancement New feature or request label Jun 30, 2021
@rlee1990
Copy link
Author

rlee1990 commented Jul 1, 2021

@Meherdeep any way to allow this? Or am I doing something wrong?

@Meherdeep
Copy link
Contributor

@rlee1990 How are you generating your token?

@rlee1990
Copy link
Author

rlee1990 commented Jul 1, 2021

This is my token code:
I am using a firebase function. I can confirm a token is then created.

const channelId = data.channelId;
    const uid = data.uid;
    const isPublisher = data.isPublisher;

    const token = RtcTokenBuilder.buildTokenWithAccount(AGORA_APP_ID, AGORA_Cert, channelId, uid, isPublisher ? RtcRole.PUBLISHER : RtcRole.SUBSCRIBER, privilegeExpiredTs);
    return {'token': token};

@Meherdeep
Copy link
Contributor

What error are you getting when you pass this token value to the tempToken parameter?

@rlee1990
Copy link
Author

rlee1990 commented Jul 1, 2021

Here is the error:
I/flutter (30663): onError: ErrorCode.InvalidToken
and the token: 006c1cc6f30444b4f628686efa644547e6eIAA5xEJgq23CIWylNCxs6X/m0cXu9iuh7ptIEXHaoWYrp6mNqbngNHC4IgBG8Wc8Oh7fYAQAAQDK2t1gAgDK2t1gAwDK2t1gBADK2t1g

@Meherdeep

@rlee1990
Copy link
Author

rlee1990 commented Jul 1, 2021

If I use this temp token that I generated from the site it works:
006c1cc6f30444b4f628686efa644547e6eIADA/q8OQEAzczW2w9TsLkEOjA03nn7sYYGBmjQMWCi9HqmNqbkAAAAAEACqPfBqTCHfYAEAAQBLId9g

@Meherdeep
Copy link
Contributor

@rlee1990 Are you generating this using String uid?

@rlee1990
Copy link
Author

rlee1990 commented Jul 1, 2021

Yes I am @Meherdeep could that be the issue?

@Meherdeep
Copy link
Contributor

Yes, because the join channel function is using int uid for now. You can fork the repo and change the code accordingly.

@rlee1990
Copy link
Author

rlee1990 commented Jul 1, 2021

Thanks will do.

@rlee1990
Copy link
Author

rlee1990 commented Jul 2, 2021

@Meherdeep My fork worked I only added an option for the string uid and still keep everything else if you want to use that when your looking to add it in.

@holy-dev
Copy link

what should be the url in the tokenUrl: ""?

I'm using node to generate token, to generate token the URL goes something like this: site.com/generate_token?channel=test&uid=120&role=subscriber

@maxxfrazer
Copy link
Contributor

@holy-dev The token URL takes the base url of your token server, but it expects endpoint to match that found in the example token server here:
https://github.com/AgoraIO-Community/agora-token-service#rtc-token

@holy-dev
Copy link

holy-dev commented Sep 2, 2021

@maxxfrazer thanks, I solved it. The url format is hardcoded in the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants