Skip to content

Commit

Permalink
Fix custom token auth issue #14.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Mar 29, 2024
1 parent c8c0151 commit 87490e1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
19 changes: 18 additions & 1 deletion examples/Messaging/Send/Send.ino
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,24 @@ void loop()

msg.data(data);

msg.notification(notification);
Messages::AndroidConfig androidConfig;

// Priority of a message to send to Android devices.
// https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidmessagepriority
androidConfig.priority(Messages::AndroidMessagePriority::_HIGH);

Messages::AndroidNotification androidNotification;

// Set the relative priority for this notification.
// Priority is an indication of how much of the user's attention should be consumed by this notification.
// Low-priority notifications may be hidden from the user in certain situations,
// while the user might be interrupted for a higher-priority notification.
// https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#NotificationPriority
androidNotification.notification_priority(Messages::NotificationPriority::PRIORITY_HIGH);

androidConfig.notification(androidNotification);

msg.android(androidConfig);

// You can set the content of msg object directly with msg.setContent("your content")

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FirebaseClient",
"version": "1.0.4",
"version": "1.0.5",
"keywords": "communication, REST, esp32, esp8266, arduino",
"description": "Async Firebase Client library for Arduino.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=FirebaseClient

version=1.0.4
version=1.0.5

author=Mobizt

Expand Down
6 changes: 3 additions & 3 deletions src/FirebaseClient.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Created March 27, 2024
* Created March 29, 2024
*
* The MIT License (MIT)
* Copyright (c) 2024 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -30,7 +30,7 @@
#undef FIREBASE_CLIENT_VERSION
#endif

#define FIREBASE_CLIENT_VERSION "1.0.4"
#define FIREBASE_CLIENT_VERSION "1.0.5"

#include <Arduino.h>
#include "./core/FirebaseApp.h"
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace firebase
if (app.auth_data.user_auth.custom_token.val[cust_tk_ns::token][i] == '.')
token_part++;

if (token_part == 3)
if (token_part == 2)
app.auth_data.app_token.val[app_tk_ns::token] = app.auth_data.user_auth.custom_token.val[cust_tk_ns::token];
else // not a valid custom token, treat as a refresh token
app.auth_data.app_token.val[app_tk_ns::refresh] = app.auth_data.user_auth.custom_token.val[cust_tk_ns::token];
Expand Down

0 comments on commit 87490e1

Please sign in to comment.